package com.sinosoft.vaccinetoai.exception;

import lombok.Getter;

/**
 * 异常枚举类
 * @author xzh
 * @date 2022-10-24 11:04
 * @since 5.0.0
 */
@Getter
public enum ExceptionEnums {

    //成功
    SUCCESS(20000, null),
    //系统异常
    ERROR(50000, "系统异常"),
    //参数异常
    PARAMS_INVALID(50101, "参数不正确"),
    //数据不存在
    DATA_NOT_FOUND(50102, "数据不存在"),
    //分组子数据存在删除失败
    GROUP_CHILD_EXIT_DELETE_INVALID(50103,"分组子数据存在删除失败"),
    // 数据状态异常
    DATA_STATUS_INVALID(50104, "数据状态异常"),
    //排序参数异常
    PARAMS_SORT_INVALID(501004,"排序参数错误"),
    //验证失败
    AUTH_UNAUTHORIZED(50201, "鉴权失败"),
    //验证码不正确
    PHONE_CODE_INVALID(50301, "验证码不正确"),
    //插件不存在
    PLUG_DATA_NOT_FOUND(50202,"插件不存在"),

    //JWT 相关 51xxx
    // JWT 相关异常
    JWT_MISSING(51001, "JWT 缺失"),
    JWT_EXPIRED(51002, "JWT 过期"),
    JWT_DURATION_EXCEEDS_LIMIT(51003, "JWT 持续时间超过最大限制（3天）"),
    JWT_INVALID_ISSUER(51004, "JWT 签发者非法"),
    JWT_INVALID_AUDIENCE(51005, "JWT 接收者非法"),
    JWT_SIGNATURE_VERIFICATION_FAILED(51006, "JWT 签名验证失败"),
    JWT_ILLEGAL_FORMAT(51007, "JWT 格式非法"),
    JWT_PARSING_FAILED(51008, "JWT 数据解析失败"),
    JWT_NOT_YET_VALID(51009, "JWT 不在生效时间范围内"),
    JWT_VALIDATION_FAILED(51010, "JWT 验证失败"),

    //订单相关 52xxxx
    ORDER_LOCAL_NO_READY_EXIST(52001,"本地订单已存在"),



    /**
     * 登录相关 101xx
     */
    //未登录（未登录或登录超时）
    LOGIN_STATE_INVALID(10100, "未登录"),
    //登录用户名不正确（用户不存在）
    LOGIN_USERNAME_INVALID(10101, "用户名不存在"),
    //登录密码不正确
    LOGIN_PASSWORD_INVALID(10102, "密码不正确"),
    //用户无法登录
    LOGIN_USER_STATUS_INVALID(10103, "用户无法登录"),
    //验证失败
    LOGIN_AUTHC_FAIL(10104, "验证失败"),
    /**
     * 注册相关 102xx
     */
    REGISTER__INIT_USER_INVALID(10201,"初始化注册失败"),
    /**
     * 用户相关
     */
    USER_ALREADY_EXISTS(10201, "用户已存在"),
    USER_PASSWORD_RESET_INVALID(10202,"原密码不正确"),
    USER_ALREADY_NOT_EXISTS(10203, "用户不存在"),
    //用户绑定失败
    USER_BINGED_INVALID(10204,"用户已绑定，绑定失败"),
    //用户余额不足
    USER_BALANCE_NOT_ENOUGH(10205,"用户智能豆余额不足"),
    //校验解读插件账户余额不足
    USER_PLUG_BALANCE_INSPECTION_RESULT_NOT_ENOUGH(10206,"检验解读插件账户余额不足"),
    //插件聊天次数超过限制
    USER_PLUG_CHAT_OVER_LIMIT(10207,"插件聊天超过限制"),
    /**
     * 用户会员
     */
    MEMBER_DICT_STATUS_INVALID(30101, "会员状态不正确"),

    NO_NEW_USER(30102,"您不是新会员"),

    /**
     * 套餐开通
     */
    PACKAGE_INFO_STATUS_INVALID(30501, "套餐状态不正确"),

    //套餐不存在
    PACKAGE_NO_EXIST(30502,"套餐不存在"),

    /**
     * 卡券核销
     */
    GIFT_CARD_NO_INVALID(30601, "卡券号码有错误"),
    GIFT_CARD_EXCHANGED(30602, "卡券已被核销"),
    GIFT_CARD_EXCHANGE_FAIL(30603, "卡券核销失败"),

    /**
     * 微信相关
     */
    WX_OPENID_INVALID(60001,"微信获取openId异常"),

    /**
     * http远程调用相关 700xx
     */
    HTTP_FETCH_INVALID(70001,"HTTP远程调用失败"),

    /**
     * LOCK相关错误 800xx
     */
    /**
     * 请勿重复提交
     */
    UN_REPEAT_SUBMIT(80001,"请勿频繁重复提交"),

    /**
     * 插件相关CODE错误信息 900xx
     */
    PLUG_USER_NOT_FOUND(90001,"用户插件信息不存在"),

    //插件到期
    PLUG_END_TIME_OVER(90002,"插件使用时间已到期"),

    //插件使用次数不足
    PLUG_USE_NUN_NOT_ENOUGH(90003,"插件的次数已用完");



    private ExceptionEnums(int code, String message) {
        this.code = code;
        this.message = message;
    }

    //异常码
    private final int code;

    //异常信息
    private final String message;

}
